const fs = require("fs");
module.exports = (app) => {
  fs.readdirSync(__dirname).forEach((file) => {
    if (file.indexOf("index") > -1) return;
    const route = require(`./${file}`);
    if (route.opts && route.opts.ws) {
      app.ws.use(route.routes()).use(route.allowedMethods());
    } else {
      app.use(route.routes()).use(route.allowedMethods());
    }
  });
};
